<template>
  <div>
    <div style="width:30%">
      <h3>考试课程简表</h3>
      <Divider style="height: 2px;margin:15px 0;display: inline-block;" />
    </div>
    <div style="width:80%">
      <Button id="b1" @click="exit()">返回</Button>
      <Button id="b1" @click="print()">考试开考课程简表打印</Button>
      <Divider style="height: 2px;margin:15px 0;display: inline-block;" />
    </div>
    <Table border :columns="columnshead" :data="ExaminationList"></Table>
    <br>
    <div style="margin: 10px;overflow: hidden">
      <div style="float: right">
        <Page :total="total" :current="1" show-elevator show-total @on-change="changePage"></Page>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        columnshead: [{
            title: '课程编号',
            key: 'CS_ID',
            sortable: true
          },
          {
            title: '课程名称',
            key: 'CS_Name'
          },
          {
            title: '教材名称',
            key: 'TB_Name'
          },
          {
            title: '教材作者',
            key: 'TB_Author'
          },
          {
            title: '教材ISBN',
            key: 'TB_ISBN'
          },
          {
            title: '考试日期',
            key: 'CS_ExamTime'
          }
        ],
        ExaminationList: [],
        total: 1,
        esId: ''
      }
    },
    created() {
      this.getParams()
      this.$axios.get(this.$host + '/examination/plan/examOpeningCourseSummary?examSessionId=' + this.esId + '&&pageNum=1&&pageSize=10').then(res => {
        console.log(res)
        this.total = res.data.data.total
        this.ExaminationList = res.data.data.list
      })
    },
    watch: {
      '$route': 'getParams'
    },
    methods: {
      getParams() {
        this.esId = this.$route.query.esId
      },
      changePage(currentPage) {
        this.$axios.get(this.$host + '/examination/plan/examOpeningCourseSummary?pageNum=' + currentPage +
          '&&pageSize=10').then(res => {
          this.ExaminationList = res.data.data.list
        })
      },
      print () {
        this.$Message.error('没有这个功能啊!');
      },
      exit() {
        this.$router.push({
          name: 'ESCList'
        })
      }
    }
  }
</script>

<style scoped>
  h3 {
    font-size: 1.75rem;
    float: left;
  }

  #b1 {
    float: right;
    background-color: burlywood;
  }

  #b2 {
    background-color: cadetblue;
  }

  #b3 {
    float: right;
    background-color: darksalmon;
  }
</style>
